﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;

namespace SmartVault.Rest
{
    /// <summary>
    /// NodeOptions
    /// 
    /// This encapsulates the various optional elements of a node request.
    /// </summary>
    public class NodeOptions
    {
        /// <summary>
        /// The depth of children to enumerate.
        /// </summary>
        public int Children = 0;
        /// <summary>
        /// Include the ACL in the request?
        /// </summary>
        public bool IncludeAcl = false;
        /// <summary>
        /// Include Extended Properties in the request
        /// </summary>
        public bool IncludeExtendedProperties = false;

        /// <summary>
        /// Include Users in the request
        /// </summary>
        //public bool IncludeUsers = false;

        /// <summary>
        /// Search Criteria
        /// 
        /// The criteria of the search
        /// </summary>
        public string SearchCriteria = string.Empty;

        /// <summary>
        /// Sort Criteria
        /// 
        /// name | modified_date | size
        /// </summary>
        public string Sort = "name";

        /// <summary>
        /// Sort Direction
        /// 
        /// asc | desc
        /// </summary>
        public string Direction = "asc";

        public NameValueCollection GetParameters()
        {
            NameValueCollection nv = new NameValueCollection();
            nv[Constants.ChildrenParameter] = this.Children.ToString();
            nv[Constants.AclParameter] = this.IncludeAcl.ToString().ToLower();
            nv[Constants.ExPropertiesParameter] = this.IncludeExtendedProperties.ToString().ToLower();
            //nv[Constants.Users] = this.IncludeUsers.ToString().ToLower();
            nv[Constants.Search] = this.SearchCriteria;
            nv[Constants.Sort] = this.Sort.ToString().ToLower();
            nv[Constants.Direction] = this.Direction.ToString().ToLower();

            return nv;
        }
    }
}
